package org.example.controller;


 import org.example.service.FuncApi;
 import org.example.service.impl.StrategyFactory;
 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FuncController {

    @Autowired
    private StrategyFactory factory;

    @PostMapping("/getData")
    public String getData(String funcName){
        String result = "";
        try {
            FuncApi api =  factory.getApiByFuncName(funcName);
            result = api.funcDeal();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}